package de.hibernate.example;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "employee")
public class Employee {

	private int id;
	private String employeeName;

//	private String password;
//	private String eMailAdress;
//	private boolean isPermanent;
//	private Calendar joinDate;
//	private Date loginTime;
	
	public List<EmployeeCourse> courses = new ArrayList<EmployeeCourse>();

	// on var or getter
	@Id
	@GenericGenerator(name = "generator", strategy = "increment")
    @GeneratedValue(generator = "generator")
	@Column(name = "employee_id")
	public int getEmployeeId() {
		return id;
	}

	public void setEmployeeId(int pEmployeeId) {
		this.id = pEmployeeId;
	}

	@OneToMany(fetch=FetchType.LAZY,mappedBy="pk.employee")
	public List<EmployeeCourse> getCourses() {
		return courses;
	}

	public void setCourses(List<EmployeeCourse> courses) {
		this.courses = courses;
	}

	@Column(nullable = false)
	public String getEmployeeName() {
		return employeeName;
	}

	public void setEmployeeName(String pEmployeeName) {
		this.employeeName = pEmployeeName;
	}

//	@Transient
//	public String getPassword() {
//		return password;
//	}
//	
//	public void setPassword(String password) {
//		this.password = password;
//	}
//
//	@Column(nullable = false)
//	public String geteMailAdress() {
//		return eMailAdress;
//	}
//
//	public void seteMailAdress(String eMailAdress) {
//		this.eMailAdress = eMailAdress;
//	}
//
//	// Basic annotation is what a column/var gets when there is no annotation,
//	// so this is kind of unnecessary
//	@Basic
//	public boolean isPermanent() {
//		return isPermanent;
//	}
//
//	public void setPermanent(boolean isPermanent) {
//		this.isPermanent = isPermanent;
//	}
//
//	@Temporal (TemporalType.DATE)
//	public Calendar getJoinDate() {
//		return joinDate;
//	}
//
//	public void setJoinDate(Calendar joinDate) {
//		this.joinDate = joinDate;
//	}
//
//	@Temporal (TemporalType.TIMESTAMP)
//	public Date getLoginTime() {
//		return loginTime;
//	}
//
//	public void setLoginTime(Date loginTime) {
//		this.loginTime = loginTime;
//	}

}
